
<div class="container">

	<!-- Title -->
	
	<!-- Alerts -->

	<!-- Search -->

	<div data-content="search" class="hide">
		
		<form action="<?=URL?>" method="post">
			
			<? foreach($data['info']['columns'] as $column): ?>
			
				<? if (!$column['hide']):?>
				
					<div class="clearfix">
						
						<label><?=$column['alias']?></label>
						
						<div class="input">
								
							<!-- Input for regular fields -->
				
							<p id="<?=$column['field']?>">
							
								<input name="search[<?=$column['field']?>]" type="text" value="<?=$data['info']['filters'][$column['field']]['value']?>"/>
						
							</p>
					
						</div>
						
					</div>
					
				<? endif; ?>
			
			<? endforeach; ?>
			
			<div class="actions">
			
				<button class="btn primary" name="action" value="search"><?=__("Search", "en")?></button> <a href="<?=URL?>" class="btn"><?=__("Cancel", "en")?></a>
			
			</div>
			
		</form>
		
		<hr>
		
	</div>

	<form action="<?=URL?>" method="post">

		<input type="hidden" name="url" value="<?=URL?>">
		
		<div class="clearfix">
		
			<!-- Actions -->
			
			<a href="<?=URL?>edit/" class="btn primary"><?=__("Add", "en")?></a>
			<button class="btn disabled" disabled name="action" data-role="action" value="delete"><?=__("Delete", "en")?></button>
			
			<!-- Links -->
			
			<a data-toggle="search" class="lnk right"><?=__("Search", "en")?></a>
			
		</div>
		
		<!-- Filters -->
		
		<? if ($data['info']['filters']): ?>
		
			<ul class="unstyled horizontal clearfix">
			
				<? foreach ($data['info']['filters'] as $filter): ?>
				
					<? if (!$filter['hide']): ?>
				
						<li><strong><?=$filter['column']?></strong> <?=$filter['value']?> <a title="Remove filter" href="<?=URL?><?=ACTION?>/<?=$filter['clean']?>">&#x2718;</a> </li>
					
					<? endif; ?>
				
				<? endforeach; ?>
			
			</ul>
		
		<? endif; ?>
		
		<? if ($data['data']): ?>
		
		
		<!-- List of items -->

		<table class="zebra-striped selectable" id="table">
		
			<thead>
			
				<tr>
				
					<th><input type="checkbox" data-action="selectall"></th>
					<? foreach($data['info']['columns'] as $column): ?>
						<? if (!$column['hide']):?>
							<th>
								<a href="<?=URL?><?=ACTION?>/<?=$uri['order']?>order:<?=$column['table']?>.<?=$column['field']?>|<? if(($column['table'].'.'.$column['field'] == $data['info']['order'][0]) && ($data['info']['order'][1] == 'asc')): ?>desc<? else: ?>asc<? endif; ?>/">
									<?=$column['alias']?>
								</a>
							</th>
						<? endif; ?>
					<? endforeach; ?>
				
				</tr>
			
			</thead>
			
			<tfoot>
			
				<tr>
				
					<th><input type="checkbox" data-action="selectall"></th>
					<? foreach($data['info']['columns'] as $column): ?>
						<? if (!$column['hide']):?>
							<th>
								<a href="<?=URL?><?=ACTION?>/<?=$uri['order']?>order:<?=$column['table']?>.<?=$column['field']?>|<? if(($column['table'].'.'.$column['field'] == $data['info']['order'][0]) && ($data['info']['order'][1] == 'asc')): ?>desc<? else: ?>asc<? endif; ?>/">
									<?=$column['alias']?>
								</a>
							</th>
						<? endif; ?>
					<? endforeach; ?>
				
				</tr>
			
			</tfoot>
		
			<tbody>
		
				<? foreach($data['data'] as $id => $item): ?>

					<tr>
						<td><input type="checkbox" name="id[]" value="<?=$item[$data['info']['key']]?>"></td>
						<? foreach($data['info']['columns'] as $column): ?>
							<? if (!$column['hide']):?>
								<td>
									<a href="<?=URL?>details/id:<?=$item[$data['info']['key']]?>">
										<?=$item[$column['field']]?>
									</a>
								</td>
							<? endif; ?>
						<? endforeach; ?>
					</tr>

				<? endforeach; ?>
			
			</tbody>
		
		</table>

		<? else: ?>
		
			<div class="clear"><?=__("No items found.", "en")?></div>
		
		<? endif; ?>

	</form>

	<!-- paging -->

	<? if (!CONFIG_LIST_PAGINATION_HIDE || $data['paging']['records'] > $params['limit']): ?>

		<div data-role="tableinfo" class="clearfix">
			
			<div class="inline"><?=__("From", "en")?> <?=$data['paging']['from']?> <?=__("to", "en")?> <?=$data['paging']['to']?> <?=__("of", "en")?> <?=$data['paging']['records']?></div>
			
			<div class="right">
			
				<ul class="unstyled horizontal paginate">
				
					<? foreach ($data['paging']['buttons'] as $button): ?>
					
						<li <? if ($button['number'] == $data['paging']['current']): ?> class="active" <? endif; ?> ><a href="<?=URL?><?=ACTION?>/<?=$button['url']?>"><?=$button['text']?></a></li>
					
					<? endforeach; ?>
				
				</ul>
			
			</div>
			
		</div>

	<? endif; ?>
		
</div>